package com.RedRiver.hospitalsystem.finance_service.common.config;

import lombok.Data;
import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

@Data
@Component
public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118675722";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCjwCBctn5JhUTHmqj6Y7NqRyPQLAKQTLm1/eB0bYFIu8DNNomqn1/QW/mLS40/kYzS8/MSVrj1zinedx6x5pQJK4HJttIxAwICaGHihQCQ1tEZbSYA8VBuFglQLaGFRhoD73+GXBjc/PfjWmSbBdNHOoco5yXtexdgb2gVaaGjvOCCmLs03HGbkIHQlIYQc2c/LQaWkjFEBYvE4VZkxAH3acQ6XIQ4ASgwN2J5GQRUn3KEAvClxGGg5DOO7KGkT+ePDO1+mCucxSgwKHmMocSmOd/meSzVyOjLuJG3lWJhWFxVDzWmZFuC+z+bAxkYco9PPxEKCYarRIO0v7ub+n6hAgMBAAECggEAL3QN7NA16LhmJjH7phQeej4DcuBOHeMeLk9ULGlPffRq+w1C998XtRnyRxut4y4a0UdAuZ/IGfOUzpNWoddgLwgcpIgGgY2Nl4UIWMySTWbzUZr/2GYWGNDqAgI3PJgEEf/lxNoLmn70lz4qyYH2qD2dzYyuwRNawueGEi56WSh7ghKoTiqli8WhD5Wb5C+LP6KF+HSUvLHYUMC7mUQPwPRw97+Ym7ieJSRXfmpKjzv99p46c6nRYPRda4WCLCyzcJcwt9/sQtRhnI7Fd5bVAF3+Lrc/VwGZGOXEHlCpvbE756514pSQmYQpgIU1cq+68VeE9V5epYOKY6Fpf+jEAQKBgQDoxfgvlYleBJfYYCPA/ae8ejTZCnrkNYrKRdP7wb/+YjB9u5CCgYGLT9x7YomlfkV0HqkFMYKj03wDHAqZh9BG/G1t/Xvp9kIMe6A2svV4KoieXTwfCR2GZIypPDlP/5ksayp/ZUVUakQDo5/OHpi84XeLl7NVCycLBvx8+cRqWQKBgQC0FwR57SQ55HY5b7QeqPaXzTHm4A9b66r/kvzL8b1eT+/r9yIN2n+yCs76dhPi6hrXG9v0RWYfI9Ap+u5bHxoNTos1HGJLGlFxvqng2bkRuVVmdcFJIdisc7IYTjhgsS5X6HWswDm6WA74nUFaLp7Cq6S2qUmhgXXltgPEwy2diQKBgQDAnek0vwIP2a8pLs0HSx79GQcYPtLYevHhVY0H/Bj60Jedw5LeW3ouJKSnOS/70RR59VEZ6hFXrY4mKJMg3sDbrNCEvshGHzAikj5OZSI5EMFCgpZYfDuBVT0MYbhvWWuP1RIyn0OSiejENibr8mejjNNWoO6VxgfF2T8fz7LX6QKBgD9F/wqfqSS2Alu3xX8oOkuniqrlej//kzrsd+ln6/Lg/xjW4Z4gcNErPwF8zwvg2MFPRn6Si4jRWmgFhA175fla6UolyNs+SfM+3AzmMkHp7flr0hdRzwD4PVCQ2voOBoxYXk/t0dqI6emrxrRawOkAyYRsAjS+eZ/VzYkqUjKRAoGBALeFzTtgMoaX/6OBdhl7ihdizEb/WL5kaD6Wd4zOcU5rQ6MrzUyyhOpxiz29zBGd6r8TJUbwKAMUk1svhmmv8fmpAmeZ5Q40OTT6AyWeknPSUhHpZGeeYsWwzy2JyTbkXeqFCqxDjcizQIjLYA0VHKK5ATlYfS4HOx0VSWON+yAv";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkFrwm3k7uYZK1YVldNAmM3NWbFv6duMqRTG+ouQ9egNB0Sf8m+lq2dy5j9BfgtHqEcaZ38kgDv+rAzENmdvlgPLMyW8BLpOZXPnqICFkQIk1Y0Jw8soM0XUfEXK9QwvSjVSdbdqTQLQ2zsm58O2Hvw0DUJ2V+ThqTOHVoK8whI0V9pKIVhiqTqltzTg6FCzCHwKhGnH3u3s5+qzDiezWhKAKsbwlEa52t8xZTEGpqL78+tguZsF7gLu9SDYPnqTq3eKXlTK9FZsiWX7ojfVVZNpbaTBpp4JERHwJnSWPZD/wyu7hsmKa4aDUhhtUJR4aClV0pTcSfu8ecvxTVg25bQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://kunhhd.natappfree.cc/financeService/bill/notyfyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://kunhhd.natappfree.cc/financeService/bill/returnUrl";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

